package com.ybzl.gateway.mapper;

import com.ybzl.gateway.domain.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;


@Mapper
@Repository
public interface DeviceMapper {

    /**
     * 新增设备状态
     *
     * @param deviceHeartbeatInfo
     */
    void insertHeartbeat(DeviceHeartbeatInfo deviceHeartbeatInfo);

    /**
     * 新增数据信息
     *
     * @param deviceInfo
     */
    void insertDeviceInfo(DeviceInfo deviceInfo);

    List<Map<String, Object>> selectDeviceInfoByMinute();

    List<String> selectHeartbeatByMinute();

    /**
     * 批量插入数据
     * @param statusInfo
     */
    void insertDeviceStatus(DeviceStatusInfo statusInfo);

    /**
     * 查询数据
     * @return
     */
    List<DeviceStatusInfo> selectDeviceStatusInfo();

    List<DeviceInfo> selectDeviceInfoBySecond();

    DeviceInfo selectLastByTagId(String tagId);

    void insertTargetDeviceInfo(DeviceInfo deviceInfo);

    List<DeviceInfo> selectTargetDeviceInfoBySecond();

    /**
     * 查询Beaconid
     * @param beaconId
     * @return
     */
    Beacon selectBeaconById(String beaconId);

    /**
     * 新增
     * @param beacon
     */
    void insertBeacon(Beacon beacon);


    List<Beacon> selectBeacon();

    void insertBeaconStatus(String beaconId, int power);

    Room selectRoomBYTagId(String tagId);

    void insertRoom(double x, double y, String tagId);

    int delBeaconByTs(Long ts);

    void insertNoIBeacon(Long ts , String exId, String tagId, int rssi, int tagPower);

    List<NoIbeacon> selectNoIbeacon();

    void saveHighEnergyTag(int energy, int flag, int power, String id);
}
